package file;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import data.DataBig;

public class ParseJester {
	
	List<DataBig> list = new ArrayList<DataBig>();
	
	public ParseJester() throws IOException{
		int uid = 1;
		String file="D:\\Jester Dataset\\jester-data-1.csv";
		BufferedReader br = new BufferedReader(new FileReader(file));
		String line;		
		while((line = br.readLine()) != null){
			String[] fields = line.split(",");
			for(int i=0; i<100; i++){
				double rat = Double.parseDouble(fields[i+1]) / 5 + 3;
				if(rat > 10){
					
				}
				else {
					list.add(new DataBig(uid, i+1, rat));
				}
			}
			uid++;
		}
		br.close();
		
		file="D:\\Jester Dataset\\jester-data-2.csv";
		br = new BufferedReader(new FileReader(file));
		while((line = br.readLine()) != null){
			String[] fields = line.split(",");
			for(int i=0; i<100; i++){
				double rat = Double.parseDouble(fields[i+1]) / 5 + 3;
				if(rat > 10){
					
				}
				else {
					list.add(new DataBig(uid, i+1, rat));
				}
			}
			uid++;
		}
		br.close();
		
		file="D:\\Jester Dataset\\jester-data-3.csv";
		br = new BufferedReader(new FileReader(file));
		while((line = br.readLine()) != null){
			String[] fields = line.split(",");
			for(int i=0; i<100; i++){
				double rat = Double.parseDouble(fields[i+1]) / 5 + 3;
				if(rat > 10){
					
				}
				else {
					list.add(new DataBig(uid, i+1, rat));
				}
			}
			uid++;
		}
		br.close();
	}

	public List<DataBig> getList() {
		return list;
	}

}
